home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Supervisor's Toolkit
/
Network Supervisor's Toolkit.iso
/
menus
/
marxmenu
/
gofile.mnu
< prev
next >
Wrap
Text File
|
1996-07-10
|
2KB
|
95 lines
Comment
=============================================================
GOFILE.MNU Copyright 1989-91 by Marc Perkel
This example allows you to find a file on your hard disk or
network and go to the directory where it is.
It requires that you have WHEREIS from the Computer Tyme DOS
ToolBox, or a WHEREIS type program that can scan your drive and
output complete file names that can be redirected to a temporary
file.
Make sure to create a file called GOFILE.BAT containing:
@ECHO OFF
MARXMENU GOFILE %1
=============================================================
EndComment
Var ChooseFiles Choice Mask TmpFile BoxDim ChTemp LastPath
StandardIO
ClearScreenFirst Off
TextColor Green Black
ExitCode = 0
Mask = UpperCase(ParamStr(2))
Writeln
;----- Exit if mask not specified.
if Mask = ''
Writeln 'Usage: GoFile <mask>'
ExitMenu
endif
;Run WHEREIS and redirect the output to a temporary file, then
;read the output file into a string array and delete the file.
Write 'Scanning for ' Mask ' Files ... '
TmpFile = UniqueFileName
Execute 'WHEREIS ' + Mask + '>' + TmpFile
ReadTextFile (TmpFile,ChooseFiles)
DelFile TmpFile
Writeln
;----- Save only Path Part
Loop ChooseFiles
ChooseFiles[LoopIndex] = PathPart(ChooseFiles[LoopIndex])
EndLoop
;----- Remove Duplicates
ChTemp = ChooseFiles
Dispose ChooseFiles
LongestLine = 0
Loop ChTemp
if ChTemp[LoopIndex] <> LastPath
LastPath = ChTemp[LoopIndex]
AppendArray(ChooseFiles,LastPath)
LongestLine = Max(LongestLine,length(LastPath))
endif
EndLoop
BoxBorderColor Green Blue
BoxInsideColor Yellow Blue
BoxHeaderColor Yellow Mag
;----- this calculates the size and position of the pick window.
if NumberOfElements(ChooseFiles) > 1
BoxDim[3] = Min(LongestLine + 6,ScreenWidth - 6)
BoxDim[4] = Min(NumberOfElements(ChooseFiles) + 2,ScreenHeight)
BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1)
BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),1)
DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4]
Choice = PickOne ChooseFiles
endif
if NumberOfElements(ChooseFiles) = 1 then Choice = ChooseFiles[1]
if Choice = '' then ExitMenu
ChDir Choice
if pos('$P',UpperCase(ReadEnv('PROMPT'))) > 0 then ExitMenu
;----- If the users prompt does not show the current path, we show it here.
TextColor Green Black
Writeln
Writeln 'Current Path = ' Path